// logs.ts
import dayjs from 'dayjs';
// const util = require('../../utils/util.js')
import { formatTime } from '../../utils/util'
// import { formatTime } from '@utils/util'
// const { formatTime } = require('@utils/util')

Component({
  data: {
    logs: [],
  },
  lifetimes: {
    attached() {
      this.setData({
        logs: (wx.getStorageSync('logs') || []).map((log: string) => {
          return {
            date: formatTime(new Date(log)),
            timeStamp: log,
            showDate: dayjs(log).format("YYYY-MM-DD HH:mm:ss"),
          }
        }),
      })
    }
  },
})
